import request from '../index';

const baseUrl = '/base-server';
const chargeUrl = '/charge-server';
const financeUrl = '/finance-server';

// 查询电站地图
export const queryStationMaps = (params: any) => {
  return request({
    // url: `http://192.168.101.16:8082${baseUrl}/stationApp/queryAppStationMapsList`,
    url: `${baseUrl}/stationApp/queryAppStationMapsList`,
    params: params,
    noLoading: true,
  });
};

// 查询站点列表
export const queryStationList = (params: any, page: any) => {
  return request({
    // url: `http://192.168.101.16:8082${baseUrl}/stationApp/queryAppStationList`,
    url: `${baseUrl}/stationApp/queryAppStationList`,
    params: params,
    extraParams: page,
    noLoading: true,
  });
};

// 查询电站运营商
export const queryChannelOperator = (params: any) => {
  return request({
    // url: `http://192.168.101.19:8082${baseUrl}/passport/queryChannelOperator`,
    url: `${baseUrl}/passport/queryChannelOperator`,
    params: params,
  });
};

// 新增站点收藏
export const addStationCollect = (params: any) => {
  return request({
    // url: `http://192.168.101.16:8082${baseUrl}/stationApp/addStationCollect`,
    url: `${baseUrl}/stationApp/addStationCollect`,
    params: params,
  });
};

// 删除站点收藏
export const delStationCollect = (params: any) => {
  return request({
    // url: `http://192.168.101.16:8082${baseUrl}/stationApp/delStationCollect`,
    url: `${baseUrl}/stationApp/delStationCollect`,
    params: params,
  });
};

// 查询收藏站点列表
export const queryStationCollect = (params: any, page: any) => {
  return request({
    url: `${baseUrl}/stationApp/pageQueryStationCollect`,
    params: params,
    extraParams: page,
    noLoading: true,
  });
};

// 查询推荐站点列表
export const queryStationRecommended = (params: any, page: any) => {
  return request({
    url: `${baseUrl}/stationApp/pageQueryStationRecommended`,
    params: params,
    extraParams: page,
    noLoading: true,
  });
};

// 查询站点详情
export const queryStationDetail = (params: any, flag: boolean) => {
  return request({
    // url: `http://192.168.101.16:8082${baseUrl}/stationApp/queryAppStationDetailByUser`,
    url: `${baseUrl}/stationApp/queryAppStationDetailByUser`,
    params: params,
    noLoading: flag,
  });
};

// 根据站点查询终端列表
export const queryPileList = (params: any, page: any) => {
  return request({
    // url: `http://192.168.101.16:8082${baseUrl}/stationApp/pageAppQueryConnectorByStationId`,
    url: `${baseUrl}/stationApp/pageAppQueryConnectorByStationId`,
    params: params,
    extraParams: page,
    noLoading: true,
  });
};

// 根据站点和用户查询站点评论
export const queryStationComment = (params: any, page: any) => {
  return request({
    url: `${baseUrl}/station/queryStationCommentByStationIdAndUserId`,
    params: params,
    extraParams: page,
    noLoading: true,
  });
};

// 查询终端详情
export const queryConnector = (params: any) => {
  return request({
    // url: `http://192.168.101.16:8082${baseUrl}/stationApp/queryConnector`,
    url: `${baseUrl}/stationApp/queryConnector`,
    params: params,
  });
}

// 查询终端详情-准备充电页面
export const queryConnectorSort = (params: any) => {
  return request({
    url: `${baseUrl}/stationApp/queryConnectorSort`,
    params: params,
  });
}

// 启动充电
export const queryStartCharge = (params: any) => {
  return request({
    // url: `http://192.168.101.16:8082${baseUrl}/stationApp/queryConnector`,
    url: `${chargeUrl}/cmd/query_start_charge`,
    params: params,
    flagRes: true,
    noToast: true,
  });
}

//扫描二维码查询终端详情
export const queryConnectorByQrCode = (params: any) => {
  return request({
    url: `${baseUrl}/stationApp/queryConnectorByQrCode`,
    params: params,
  });
}

//输入快捷码查询终端详情
export const queryConnectorByShortcutCode = (params: any) => {
  return request({
    url: `${baseUrl}/stationApp/queryConnectorByShortcutCode`,
    params: params,
  });
}


//查询账户信息
export const getAccount = (params: any) => {
  return request({
    url: `${financeUrl}/account/getAccount`,
    params: params,
  });
}

//新增电站评论
export const addStationComment = (params: any) => {
  return request({
    url: `${baseUrl}/station/addStationComment`,
    params: params,
  });
}